package com.hspedu.newData.LCR;

import com.hspedu.newData.dmsxl.ds.ListNode;

/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-17 
 * @Version: 1.0
 */

public class LCR171训练计划Ⅴ {

    ListNode getIntersectionNode(ListNode headA, ListNode headB) {

        ListNode pA = headA;
        ListNode pB = headB;

        while (pA != pB){

            pA = pA != null ? pA.next : headB;
            pB = pB != null ? pB.next : headA;
        }

        return pA;
    }
}
